import 'package:flutter/material.dart';
import 'package:hugeicons/hugeicons.dart';
import 'package:permission_handler/permission_handler.dart';

import '../../../base/base_model.dart';
import '../../../resources.dart';

/// created by hcl
/// on 2025/4/5
/// FileModel
/// desc
class FileModel extends BaseModel {
  List<NormalModel> buttons = [
    NormalModel('文件管理', 'fileManager'),
    NormalModel('图片', 'imageManager'),
    NormalModel('视频', 'videoManager')
  ];
  List<IconData> icons = [
    HugeIcons.strokeRoundedFile01,
    HugeIcons.strokeRoundedImage01,
    HugeIcons.strokeRoundedVideo01
  ];

  @override
  void initData() {}

  void goManager(int index) {
    requestPermission(Permission.storage).then((value) {
      if (value) {
        if (index == 0) {
          Nav.push(routerName: AppRoutes.fileManager);
        } else if (index == 1) {
          Nav.push(routerName: AppRoutes.imageManager);
        } else {
          showToast('功能未开放，敬请期待');
        }
      } else {
        showToast('请打开储存权限');
      }
    });
  }
}
